import java.util.Scanner;
import java.io.*;
public class FitChallenge
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
Person thisPerson = new Person();
//do
while (1==1)
{
switch (switchMenu())
{
case 'D': thisPerson.display();
			break;
case 'N': System.out.println();
System.out.print("What is the Person's name : ");
String s = keyboard.next();
System.out.println("What is " +s+ "'s Gender?");
String stringGen = keyboard.next();
char gender = stringGen.charAt(0);
System.out.println("What is " +s+ "'s Height in inches?");
int height = keyboard.nextInt();
System.out.println("What is " +s+ "'s Weight in pounds?");
int weight = keyboard.nextInt();
System.out.println("What is " +s+ "'s Calorie Goal?");
int goal = keyboard.nextInt();
thisPerson = new Person(s, gender, height, weight, goal);
break;
case 'F': System.out.println();
System.out.println("What are the net calories?  : ");
int calories = keyboard.nextInt();
System.out.println("What is the percentage of Carbohydrates, in grams?");
int carbs = keyboard.nextInt();
System.out.println("What is the percentage of Fat, in grams?");
int fat = keyboard.nextInt();
System.out.println("What is the percentage of Protein, in grams?");
int protein = keyboard.nextInt();
thisPerson.addFood(calories, carbs, fat, protein);
break;
case 'E': System.out.println();
System.out.println("How many calories did you burn today?");
int exercise = keyboard.nextInt();
System.out.print("Was it longer than 30 minutes? (Y/N)");
String stringDur = keyboard.next();
char duration = stringDur.charAt(0);
thisPerson.addExercise(exercise, duration);
break;
case 'S': try{ thisPerson.savePerson();} catch (Exception e) {
System.out.println("Error saving " + e.getMessage());}
break;
case 'L':
System.out.print("Enter the name of the Person : ");
try {thisPerson = thisPerson.loadPerson(keyboard.next());} catch (Exception e) {
System.out.println("Error " + e.getMessage());}
break;
case 'C':
thisPerson.calculatePoints();
break;
case 'X': System.out.println("Goodbye");
System.exit(0);
break;
}
}
//while (switchMenu() != 'X');
}

public static char switchMenu()
{
	Scanner keyboard = new Scanner(System.in);
	System.out.print("(D)isplay Person, (C)alculate Points, (N)ew Person, Add (F)ood, Add (E)xercise, (S)ave Person, (L)oad Person, e(X)it :");
	String input = keyboard.next();
	char d = input.charAt(0);
	char c = Character.toUpperCase(d);
	return c;
}

}